From: Derick Alangi Date: Mon, 25 Feb 2019 12:28:37 +0000 (+0100) Subject: actions: Improve Action class code for clarity & consistency X-Git-Tag: 1.34.0-rc.0~2728 X-Git-Url: http://git.cyclocoop.org/%22.%24match%5B1%5D.%22?a=commitdiff_plain;h=ae87a51b05b69c33cef363930f61121d9bb7820f;p=lhc%2Fweb%2Fwiklou.git actions: Improve Action class code for clarity & consistency ~ Move local variable $obj to one liner as it's redundant in this case. ~ Use === check instead of == as in order case above for the purpose of consistency. ~ Make use of single quotes for strings literals instead of double quotes. Change-Id: I69650cacb0658a7369147ea5e9933fb5585e3376 --- diff --git a/includes/actions/Action.php b/includes/actions/Action.php index f288a5cb1f..f892c5e34e 100644 --- a/includes/actions/Action.php +++ b/includes/actions/Action.php @@ -101,8 +101,7 @@ abstract class Action implements MessageLocalizer { if ( !class_exists( $classOrCallable ) ) { return false; } - $obj = new $classOrCallable( $page, $context ); - return $obj; + return new $classOrCallable( $page, $context ); } if ( is_callable( $classOrCallable ) ) { @@ -142,7 +141,7 @@ abstract class Action implements MessageLocalizer { } else { $actionName = 'view'; } - } elseif ( $actionName == 'editredlink' ) { + } elseif ( $actionName === 'editredlink' ) { $actionName = 'edit'; } @@ -359,7 +358,7 @@ abstract class Action implements MessageLocalizer { */ protected function setHeaders() { $out = $this->getOutput(); - $out->setRobotPolicy( "noindex,nofollow" ); + $out->setRobotPolicy( 'noindex,nofollow' ); $out->setPageTitle( $this->getPageTitle() ); $out->setSubtitle( $this->getDescription() ); $out->setArticleRelated( true );